#include "muzhai.h"
#include "ui_muzhai.h"

MuZhai::MuZhai(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MuZhai)
{
    ui->setupUi(this);
    this->resize(1774,1000);
    NKlabel=new QLabel(this);
    NKmovie=new QMovie(":/scene/muzhai.gif");//填文件地址
    NKlabel->setMinimumSize(1774,1000);//设置标签为最小尺寸

    //QSize si(this->width(),this->height());
    //NKmovie->setScaledSize(si);// 将QMovie与标记相关联
    //NKmovie->setSpeed(100);//设置标签和按钮属性
    NKlabel->setMovie(NKmovie);
    NKmovie->start();
    QObject::connect(NKmovie,&QMovie::frameChanged,[=](){
        int currentFrameNumber = NKmovie->currentFrameNumber();
        int framecount = NKmovie->frameCount();
        if (currentFrameNumber == framecount-1)//如果已经播放到最后一帧，则停止播放
        {
            //NKmovie->stop();
            //this->close();
        }
    });
    QObject::connect(NKmovie, SIGNAL(frameChanged(int)), this, SLOT(onFrameChanged(int)));

}

MuZhai::~MuZhai()
{
    delete ui;
}

void MuZhai::on_pushButton_clicked()
{
    this->close();
    //ptc=new fire;
    //ptc->show();
}

void MuZhai::on_pushButton_2_clicked()
{
    this->close();
    scienceclub=new Scienceclub;
    scienceclub->show();
}
